<script>
    $(document).ready(function ()
    {
        $('#data').dataTable( {
            "sPaginationType": "full_numbers",
            "bProcessing": true,
            "aaSorting": [[ 0, "asc" ],[ 1, "asc"],[ 2, "asc"],[ 3, "asc"]]
        });
    });
</script>

<fieldset>
    <div class="products index">
        <h2><?php echo __('Products'); ?></h2>
        <br />
        <div class="newbutton">
            <ul>
                <li><?php echo $this->Html->link(__('Add New Products'), array('action' => 'add')); ?></li>
                <li><?php echo $this->Html->link(__('List Archived Products'), array('action' => 'indexarchive')); ?></li>
                <li><?php echo $this->Html->link(__('List Products With No Supplier'), array('action' => 'indexnosupplier')); ?></li>
            <ul>
        </div>
        <br><br>


        <table id="data" class="table" cellpadding="0" cellspacing="0"  border="0">
            <thead>
                <tr>
                    <th>Supplier</th>
                    <th>Brand</th>
                    <th>Range</th>
                    <th>Category</th>
                    <th>Item</th>
                    <th>Size</th>
                    <th>Retail Price</th>
                    <th>Stock</th>
                    <th>Barcode</th>
                    <th class="actions"><?php echo __('Actions'); ?></th>
                </tr>
            </thead>

            <tbody>
                <?php foreach ($products as $product): ?>
                    <tr>
                        <td><?php echo h($product['Suppliers']['supplierName']); ?>&nbsp;</td>
                        <td><?php echo h($product['Productsbrand']['name']); ?>&nbsp;</td>  
                        <td><?php echo h($product['Productsrange']['name']); ?>&nbsp;</td>  
                        <td><?php echo h($product['Productscategory']['name']); ?>&nbsp;</td>  
                        <td><?php echo h($product['Product']['description']); ?>&nbsp;</td>
                        <td><?php echo h($product['Product']['size']); ?>&nbsp;</td>
                        <td><?php echo h($product['Product']['retail_price']); ?>&nbsp;</td>
                        <td><?php echo h($product['Product']['onhand_level']); ?>&nbsp;</td>
                        <td><?php echo h($product['Product']['barcode']); ?>&nbsp;</td>

                        <td class="actions">
                            <?php echo $this->Html->link(__('View'), array('action' => 'view', $product['Product']['id'])); ?>
                            <?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $product['Product']['id'])); ?>
                            <?php echo $this->Form->postLink(__('Archive'), array('action' => 'delete', $product['Product']['id']), null, __('Are you sure you want to archive product, %s %s %s %s ?', $product['Productsbrand']['name'],$product['Productsrange']['name'],$product['Productscategory']['name'],$product['Product']['description'])); ?>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </div>

        </tbody>
    </table>

</div>

</fieldset>           





